package com.pdemo.core.entity;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.pdemo.core.genericdao.BaseEntity;

@Entity
@Table(name="USER")
@Inheritance(strategy= InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="USER_TYPE",discriminatorType = DiscriminatorType.STRING, length = 20)
public abstract class User extends BaseEntity{
	private static final long serialVersionUID = -2625757161261992906L;
	
	@Column(name="NAME", length=10)
	private String name;
	
	@Column(name="CNID",length = 18)
	private String cnid;
	
	@Column(name="GENDER")
	private Integer gender;
	
	@Column(name="EMAIL", length=30)
	private String email;
	
	@Column(name="EMAIL_CONFIRMED_AT")
	@Temporal(TemporalType.TIMESTAMP)
	private Date emailConfirmedAt;
	
	@Column(name="MOBILE", length=13)
	private String mobile;
	
	@Column(name="LOCKED")
	private Boolean locked;
	
	@Column(name="LOCKED_AT")
	@Temporal(TemporalType.TIMESTAMP)
	private Date lockedAt;
	
	@Column(name="BLOCKED")
	private Boolean blocked;
	
	@Column(name="BLOCKED_AT")
	@Temporal(TemporalType.TIMESTAMP)
	private Date blockedAt;
	
	@Column(name="PASSWORD", length=126)
	private String password;
	
	@Column(name="PASSWORD_SENT_AT")
	@Temporal(TemporalType.TIMESTAMP)
	private Date passwordSentAt;
	
	
	@OneToMany(cascade=CascadeType.ALL, fetch = FetchType.LAZY, mappedBy="user")
	private List<UserActivity> userActivities;


	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}


	public String getCnid() {
		return cnid;
	}


	public void setCnid(String cnid) {
		this.cnid = cnid;
	}


	public Integer getGender() {
		return gender;
	}


	public void setGender(Integer gender) {
		this.gender = gender;
	}


	public String getEmail() {
		return email;
	}


	public void setEmail(String email) {
		this.email = email;
	}


	public Date getEmailConfirmedAt() {
		return emailConfirmedAt;
	}


	public void setEmailConfirmedAt(Date emailConfirmedAt) {
		this.emailConfirmedAt = emailConfirmedAt;
	}


	public String getMobile() {
		return mobile;
	}


	public void setMobile(String mobile) {
		this.mobile = mobile;
	}


	public Boolean getLocked() {
		return locked;
	}


	public void setLocked(Boolean locked) {
		this.locked = locked;
	}


	public Date getLockedAt() {
		return lockedAt;
	}


	public void setLockedAt(Date lockedAt) {
		this.lockedAt = lockedAt;
	}


	public Boolean getBlocked() {
		return blocked;
	}


	public void setBlocked(Boolean blocked) {
		this.blocked = blocked;
	}


	public Date getBlockedAt() {
		return blockedAt;
	}


	public void setBlockedAt(Date blockedAt) {
		this.blockedAt = blockedAt;
	}


	public String getPassword() {
		return password;
	}


	public void setPassword(String password) {
		this.password = password;
	}


	public Date getPasswordSentAt() {
		return passwordSentAt;
	}


	public void setPasswordSentAt(Date passwordSentAt) {
		this.passwordSentAt = passwordSentAt;
	}


	public List<UserActivity> getUserActivities() {
		return userActivities;
	}


	public void setUserActivities(List<UserActivity> userActivities) {
		this.userActivities = userActivities;
	}
	
	
	

}
